<section class="user-message-list">
    <form action="<?php echo $this->baseUrl(); ?>/message/delete/">
        <table class="user-message-table">
            <thead>
                <tr>
                    <th width="15"></th>
                    <th width="270">Subject</th>
                    <th width="200">Correspondent</th>
                    <th width="130">Date</th>
                </tr>
            </thead>
            <tbody>
                <?php
                    foreach ($this->messages as $message)
                    {
                        $message_row_class  = array();
                        $delete_url         = $this->baseUrl()."/message/delete/id/".$message->id;
                        if($message->Unread > 0)
                            $message_row_class[]    = 'unread';
                ?>
                    <tr class="user-message-list-row <?php echo implode(' ', $message_row_class); ?>">
                        <td class="user-message-list-column-check"><input type="checkbox" name="message_ids[]" value="<?php echo $message->Id; ?>" /></td>
                        <td class="user-message-list-column-title">
                            <a href ="<?php echo $this->baseUrl(); ?>/user/view/id/<?php echo $this->profile_id; ?>/message/<?php echo $message->Id; ?>#viewmessage" id="">
                                <?php
                                    echo $message->Subject;
                                    if($message->Unread > 0)
                                    {
                                        echo ' ('.$message->Unread.')';
                                    }
                                ?>
                            </a>
                        </td>
                        <td class="user-message-list-column-user"><?php echo ($message->Userfrom->Id == $this->user->Id ? $message->Userto->Fullname : $message->Userfrom->Fullname); ?></td>
                        <td class="user-message-list-column-date"><?php echo $message->SendDate;?></td>
                    </tr>
                 <?php } ?>
            </tbody>
        </table>
        <section class="user-message-list-options">
            With selected: <input type="submit" class="user-message-list-option-delete" value="delete" />
        </section>
    </form>
</section>